package dataserver.controller.vo;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.annotation.JSONType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
@JSONType(orders = { "code", "message", "count", "data" })
public class ResponseInfo implements Serializable {
    private static final long serialVersionUID = 1L;

    private Integer code = 200;
    private String message = "成功";
    private JSONArray data;
    private int count = 0;

    public ResponseInfo(int retResult, JSONArray retData) {
        this.code = 200;
        this.message = "成功";
        this.data = retData;
        this.count = retResult;
    }

    public ResponseInfo(String errorInfo) {
        this.code = 500;
        this.message = errorInfo;
        this.data = null;
        this.count = 0;
    }
}
